﻿using UnityEngine;
using System.Collections;

public class StartMenu : MonoBehaviour {

	public GameObject title;
	public GameObject playerImage;
	public GameObject topToStart;
	public GameObject screenFade;

	private Color fadeCol = new Color (0, 0, 0, 0.25f);
	// Use this for initialization
	void Start () 
	{
		screenFade.GetComponent<SpriteRenderer> ().color = Color.black;
		screenFade.GetComponent<Renderer> ().material.color = fadeCol;

		SoundManager.PlayMusic("Intro");
	}
	/// <summary>
	/// Activate this instance.
	/// </summary>
	public void Activate()
	{
		MenueAni.MoveTo (title, new Vector3(1f, 0.7f, 0), 0.5f, 0f);
		MenueAni.MoveTo(playerImage, new Vector3(-4, -1, 0), 0.5f, 0.0f);
		MenueAni.MoveTo(topToStart, new Vector3(-1.9f, -2.25f, 0), 0.3f, 0.5f);
		MenueAni.FadeTo(screenFade, fadeCol, 0.3f, 0.2f);

		SoundManager.PlayMusic("Intro");
	}
	/// <summary>
	/// Raises the start pressed event.
	/// </summary>
	void OnStartPressed()
	{
		MenueAni.MoveTo (title, new Vector3(12, 0.7f, 0), 0.5f, 0.0f);
		MenueAni.MoveTo (playerImage, new Vector3(-12, -1, 0), 0.5f, 0.0f);
		MenueAni.MoveTo (topToStart, new Vector3(0, -10, 0), 0.3f, 0.0f);
		MenueAni.FadeTo (screenFade, Color.clear, 0.3f, 0.2f);

		GameManager.Game.Restart ();
	}
}
